package com.itchen.hospital.controller;

import com.github.pagehelper.PageInfo;
import com.github.pagehelper.util.StringUtil;
import com.itchen.hospital.common.Result;
import com.itchen.hospital.pojo.Doctor;
import com.itchen.hospital.pojo.Params;
import com.itchen.hospital.service.AppointmentService;
import com.itchen.hospital.service.DoctorService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;

@RestController
@RequestMapping("/Appointment")
@Tag(name = "预约挂号接口")
@CrossOrigin
@RequiredArgsConstructor
public class AppointmentController {

    private final AppointmentService appointmentService;

    @GetMapping("/findBySearch")
    @Operation(summary = "条件查询")
    public Result findBySearch(Params params) {
        PageInfo<Doctor> list = appointmentService.search(params);
        return Result.success(list);
    }

    @PostMapping("/update")
    @Operation(summary = "挂号")
    public Result update(@RequestBody Params params) throws ParseException {
        appointmentService.update(params);
        return Result.success();
    }

}
